﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace pxt
{
    public class AnnouncementSystem
    {
        // Members
        // setup a dictionary of the announcements
        List<AnnouncementText> mAnnouncements;

        public AnnouncementSystem()
        {
        }

        public void Initialize()
        {
            mAnnouncements = new List<AnnouncementText>();
        }

        public void Update(GameTime gt)
        {
            foreach (AnnouncementText text in mAnnouncements)
            {
                text.Update(gt);
            }

            for (int i = 0; i < mAnnouncements.Count; i++)
            {
                if (!mAnnouncements[i].Display)
                {
                    mAnnouncements.RemoveAt(i);
                }
            }
        }

        public void FireAnnouncement(string text, Color color)
        {
            AnnouncementText temp = new AnnouncementText();
            temp.Message = text;
            temp.Color = color;
            temp.Display = true;
            mAnnouncements.Add(temp);
        }
        //public void AddAnnouncement(AnnouncementText annc, string id)
        //{
        //    mAnnouncements.Add(id, annc);
        //}

        //public void ShowAnnouncement()
        //{
        //   // mAnnouncements[id].Draw();
        //    mAnnouncements[id].Display = true;
        //}

        public void Draw()
        {
            foreach (AnnouncementText text in mAnnouncements)
            {
                text.Draw();
            }
        }
    }
}